home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6292 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  41 lines

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP! Please! Why doesn't this work
  5. Date: 21 Feb 1996 10:08:45 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4geqvd$jse@hpbblb.bbn.hp.com>
  8. References: <Pine.ULT.3.91a.960215131933.614A-100000@red5.cac.washington.edu>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:Pine.ULT.3.91a.960215131933.614A-100000@red5.cac.washington.edu
  15.  
  16. "Aaron T. Baldie" <atb@cac.washington.edu> wrote:
  17. >...
  18. >main()
  19. >{
  20. >  char **solution_array;
  21. >  int size, row, col;
  22. >  size = 20;
  23. >    solution_array = (char **) malloc(size);
  24. You must allocate more memory because these are the bytes to be allocated:
  25.     solution_array = (char **) malloc(size * sizeof(char **));
  26.                                           ^^^^^^^^^^^^^^^^^^         
  27. >      for (row=0; row<size; row++){
  28. >       solution_array[row] = (char *) malloc(size);
  29. here too:
  30.            solution_array[row] = (char *) malloc(size * sizeof(char *));
  31.                                                      ^^^^^^^^^^^^^^^^^
  32. >      }
  33. >    
  34. >    initialize_array(solution_array, size);  
  35. >    print_maze(solution_array, size)
  36. >}
  37. >...
  38. Good luck,
  39. Matthias
  40.  
  41.